<template>
    <div>
        <table>
            <tr>
                <td>number</td>
                <td>name</td>
            </tr>
            <tr v-for="user in users" :key="user">
                <td>{{ user.userId }}</td>
                <td>{{ user.username }}</td>
            </tr>
        </table>
    </div>
</template>

<script>
export default {
    name: 'personal',
    data() {
        return {
            users: [],
            loginForm: {
                userId: '',
                password: '',
            },
        };
    },

    created() {
        this.$axios.post('http://localhost:8081/home/personal', this.loginForm).then((res) => {
            console.log(res.data);
            if (res?.data.code === 200) {
                this.users = res.data?.data;
            } else {
                this.$router.push('/login');
            }
        });
    },
};
</script>

<style scoped></style>